package com.example.testdb3.mapper;

import com.example.testdb3.entiry.UserInfo;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface UserMapper {

    // @Insert("insert into `user_info` (name,password,create_time) values (#{name},#{password},#{createTime});")
    void add(UserInfo userInfo);

    void update(UserInfo userINfo);


    @Select("select * from `user_info` where create_time between #{startTime} and #{endTime}")
    Page<UserInfo> pageUserInfos(LocalDateTime startTime, LocalDateTime endTime);

    @Select("select  * from `user_info`")
    List<UserInfo> list();

    @Delete("delete from `user_info` where id=#{id}")
    void delete(Long id);
}
